<?php

use yii\db\Migration;

class m210915_111731_minerva_main_config extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%minerva_main_config}}', [
            'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id'",
            'unit_name' => "char(32) NULL COMMENT '单位名称'",
            'upload_model' => "int(11) NULL DEFAULT '0' COMMENT '服务器模式 0默认服务器 1动态服务器'",
            'check_model' => "int(11) NULL DEFAULT '0' COMMENT '审核模式 0自动审核 1手动审核'",
            'path_dep1' => "int(11) NULL DEFAULT '0' COMMENT '部门名称1  0：未选  1：选中'",
            'path_dep2' => "int(11) NULL DEFAULT '0' COMMENT '部门名称2  0：未选  1：选中'",
            'path_uid' => "int(11) NULL DEFAULT '0' COMMENT '用户名称  0：未选  1：选中'",
            'path_task' => "int(11) NULL DEFAULT '0' COMMENT '任务名称  0：未选  1：选中'",
            'path_time' => "int(11) NULL DEFAULT '0' COMMENT '任务时间  0：未选  1：选中'",
            'min_file_size' => "bigint(20) NULL DEFAULT '0' COMMENT '最小文件'",
            'max_file_size' => "bigint(20) NULL DEFAULT '0' COMMENT '最大文件'",
            'max_file_nums' => "bigint(20) NULL DEFAULT '0' COMMENT '文件数量'",
            'pvw_exts' => "varchar(255) NULL DEFAULT '' COMMENT '文件数量'",
            'pw_switch' => "int(11) NULL DEFAULT '0'",
            'login_file_num' => "int(11) NULL DEFAULT '0'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='大数据系统-参数配置'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        $this->insert('{{%minerva_main_config}}',['id'=>'1','unit_name'=>'重庆泛涵数码科技','upload_model'=>NULL,'check_model'=>NULL,'path_dep1'=>'1','path_dep2'=>'0','path_uid'=>'0','path_task'=>'0','path_time'=>'0','min_file_size'=>'0','max_file_size'=>'0','max_file_nums'=>'0','pvw_exts'=>'txt,mp4,mp3','pw_switch'=>'0','login_file_num'=>'0']);
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%minerva_main_config}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

